package com.stropheware.droidDefense;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.text.TextPaint;

public class PlayerMenu {
	
	private GameBoard gameBoard;
	private Context context;
	private GameManager manager;
	private int height;
	private int width;
	
	private Paint backgroundPaint;
	private Rect backgroundRect;
	private TextPaint textPaint = new TextPaint();
	
	public PlayerMenu(GameBoard gameBoard, GameManager manager, Context context){
		
		this.gameBoard = gameBoard;
		this.context = context;
		this.manager = manager;
		height = gameBoard.actualBottomMenuHeight;
		width = gameBoard.actualWidth-gameBoard.actualMenuWidth;
		backgroundPaint = new Paint(Color.BLACK);
		backgroundRect = new Rect();
		backgroundRect.set(0, gameBoard.actualHeight - height, gameBoard.actualWidth-gameBoard.actualMenuWidth, gameBoard.actualHeight);
		textPaint = new TextPaint();
		textPaint.setAntiAlias(true);
		textPaint.setTextSize(15*gameBoard.densityScalar);
	}

	public void drawMenu(Canvas canvas){
		canvas.drawRect(backgroundRect, backgroundPaint);
		
		textPaint.setColor(0xff74AC23);
		canvas.drawText("Coin: ", 10 , gameBoard.actualHeight - height/4, textPaint);
		textPaint.setColor(Color.YELLOW);
		canvas.drawText(""+manager.money, 46*gameBoard.densityScalar , gameBoard.actualHeight - height/4, textPaint);
		textPaint.setColor(0xff74AC23);
		canvas.drawText("Lives: ",  width/4,  gameBoard.actualHeight - height/4, textPaint);
		textPaint.setColor(Color.GREEN);
		canvas.drawText(""+manager.livesLeft, width/4 + 41*gameBoard.densityScalar  , gameBoard.actualHeight - height/4, textPaint);
		textPaint.setColor(0xff74AC23);
		canvas.drawText("Score: ", width/2,  gameBoard.actualHeight - height/4, textPaint);
		textPaint.setColor(Color.RED);
		canvas.drawText(""+manager.score, width/2 + 46*gameBoard.densityScalar , gameBoard.actualHeight - height/4, textPaint);
		textPaint.setColor(0xff74AC23);;
		canvas.drawText("Round: ", 3*width/4 ,  gameBoard.actualHeight - height/4, textPaint);
		textPaint.setColor(Color.WHITE);
		canvas.drawText(""+manager.roundNum, 3*width/4 + 51 *gameBoard.densityScalar, gameBoard.actualHeight - height/4, textPaint);
	}
	
}
